package com.io.input;

import java.io.*;

public class ReaderDemo {

	public static void main(String[] args) {

		String s = "Hello world";

		// create a StringReader
		Reader reader = new StringReader(s);

		// create a char array to read chars into
		char cbuf[] = new char[5];

		try {
			// read characters into an array.
			System.out.println("" + reader.read(cbuf));

			// print cbuf
			System.out.println(cbuf);

			// close the stream
			reader.close();

		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}